﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace TwoWheels.Order
{
    public class OrderDetail
    {
        public OrderDetail(int productID, int quantity)
        {    
            this.productID = productID;
            this.quantity = quantity;

            const string cnStr = @"Data Source=DUO-P8600;Initial Catalog=TwoWheels;Integrated Security=True";
            TwoWheelsDatabase tdb = new TwoWheelsDatabase(cnStr);

            this.price = (float)(from p in tdb.products where p.ProduktID == this.productID select p.CenaJednostkowa).ToList().First();
            

        }

        public int OrderID
        {
            get { return this.orderID;  }
            set { this.orderID = value;  }
        }

        private int orderID;  //wpisane po wlozeniu do bazy orderu
        private int productID;
        private float price;
        private int quantity;
        private float discount;
    }
}